﻿using Core.Cache.Memory;
using Core.Cache.Redis;
using System;
using System.Collections.Generic;
using System.Text;

namespace Core.Cache
{
    public class CacheFactory : ICacheFactory
    {
        private IRedisClient _redisClient;
        private IMemoryCacheClient _memoryCacheClient;
        public CacheFactory(IRedisClient redisClient, IMemoryCacheClient memoryCacheClient)
        {
            _redisClient = redisClient;
            _memoryCacheClient = memoryCacheClient;
        }
        public ICacheClient CreateClient(CacheType cacheType)
        {
            switch (cacheType)
            {
                case CacheType.Redis:
                    return _redisClient;
                case CacheType.MemoryCache:
                    return _memoryCacheClient;
            }
            return null;
        }
    }
}
